<?php 
if (!defined("BASEPATH")) exit("No direct script access allowed");

	class Daemon_hooks {
	
		function _call_hook() {
			
		}
		
		function call_daemon() {
			$CI = & get_instance();
			if(defined("DB_ERROR") or $CI->db->trans_status() === FALSE) {
				//$this->db->query("rollback");
				$CI->db->trans_rollback();
				//echo "rollback";
			} else {
				//$CI->db->query("commit");
				$CI->db->trans_complete();
				//echo "commit";
				//$this->db->trans_rollback();
			}
			
			$CI->load->model("sys_log");
			if($CI->uri->segment(1) != "daemonc" and $CI->sys_log->getSysCnt()) {
				$CI->db->cache_delete_all();
				$CI->load->library("daemon");
				$CI->daemon->execute_background();
			}
		}
	
	}